$(".scott *:last").css("border-right","#ddd 1px solid"); 

$(".scott *:first").css({
  "border-top-left-radius":"5px",
  "border-bottom-left-radius":"5px"
}); 

$(".scott *:last").css({
	"border-top-right-radius":"5px",
    "border-bottom-right-radius":"5px"
}); 

var aspan = $(".ranklist ul li span");
aspan.each(function(index){
    $(this).html(index+1);
    if(index<3){
        $(this).css("background-color","#f00");  
    }
});


$(".recon").children("div:nth-child(1)").children("div:nth-child(1)").css("border-top"," 0px solid #eee");

var txtReson;

$(function(){

	function useraddbtn1() {
	    $(this).html("取消关注");
        $(this).css({
            "background-color":"#a6a6a6",
            "color":"#fff",
            "text-align":"center",
            "outline":"none",
        });
	    $(this).one("click", useraddbtn2);
	}
	function useraddbtn2() {
	    $(this).html("加关注");
	    $(this).one("click", useraddbtn1);
        $(this).css({
            "background-color":"",
            "color":"",
            "text-align":"",
            "outline":"none",
        });
	}
	$(".useraddbtn").one("click", useraddbtn1);



	var usertimer = null;

    $(".enjlist .user,.uhead .user").on("mouseover mouseout",function(event){
     if(event.type == "mouseover"){
            clearTimeout(usertimer);
            var left = $(this).offset().left - 40 + "px";
            var top = $(this).offset().top - 191 + "px";
            $("#userinfo").css({
                "display":"block",
                "visibility":"visible",
                "left":left,
                "top":top
            });
     }else if(event.type == "mouseout"){
        usertimer = setTimeout(function(){
            $("#userinfo").css({
                "display":"none"
            });
        },200);
     }
    });

	$("#userinfo").on("mouseover mouseout",function(event){
        event.stopPropagation();
        event.preventDefault();
	 if(event.type == "mouseover"){
	  clearTimeout(usertimer);
	 }else if(event.type == "mouseout"){
	    usertimer = setTimeout(function(){
			$("#userinfo").css({"display":"none"});
		},100);
	 }
	});



	var fxtimer = null;
    $(".mar_fx").click(function(){
    	clearTimeout(fxtimer);
        $(this).children(".sharebox").toggle();
    });
	$(".mar_fx").mouseout(function(){  
		fxtimer = setTimeout(function(){
			$(".atmar .sharebox").css({"display":"none"});
		},200);
	});
	$(".atmar .sharebox").on("mouseover mouseout",function(event){
	 if(event.type == "mouseover"){
	  clearTimeout(fxtimer);
	 }else if(event.type == "mouseout"){
	    fxtimer = setTimeout(function(){
			$(this).css({"display":"none"});
		},200);
	 }
	});


	var sztimer = null;
    $(".mar_sz").click(function(){
    	clearTimeout(sztimer);
        $(this).children(".usersetbox").toggle();
    });
    
	$(".mar_sz").mouseout(function(){  
		sztimer = setTimeout(function(){
			$(".atmar .usersetbox").css({"display":"none"});
		},200);
	});
	$(".atmar .usersetbox").on("mouseover mouseout",function(event){
	 if(event.type == "mouseover"){
	  clearTimeout(sztimer);
	 }else if(event.type == "mouseout"){
	    sztimer = setTimeout(function(){
			$(this).css({"display":"none"});
		},200);
	 }
	});






    $(".pullmenu dt,.pullmenu dt a,.pullmenu dt i").click(function(){
        $(".pullmenu dd").each(function(){
                $(this).parents(".pullmenu").css({"z-index":"10"});
                $(this).hide();
        });
        $(this).parents(".pullmenu").find("dd").show();
        $(this).parents(".pullmenu").css({"z-index":"100"});
        return false;
    });
    $(".pullmenu dd a").click(function(){
        $(this).parents(".pullmenu").children("dt").find("a").html($(this).html());
        $(this).parents(".pullmenu").find("dd").hide();
        return false;
    });






/**********************展开 收起  开始 ********************/
{
    $(window).scroll(function () {
        var $mcons = $('.mcon:visible');
        for (var i = 0; i < $mcons.length; i++) {
            var $mcon = $($mcons[i]);
            showAskcon($mcon);
        }
    });

    function showAskcon($container){
        var $ongetaskcon = $container.find('.meta_item'),
            $askcon = $container.find('.askcon');
        var containerTop = $container.offset().top,
            btnTop = $ongetaskcon.offset().top,
            scrollTop = $(window).scrollTop(),
            winHeight = $(window).height();

        if($container.is(":visible") && btnTop > (scrollTop + winHeight)){
            $askcon.show();
        } else {
            $askcon.hide();
        }

        if(containerTop > (scrollTop + winHeight)){
            $askcon.hide();
        }
    }
    // 展开
    $(".atimg,.amore").click(function(){
        var $sender = $(this),
            $container = $sender.parents('.ucon');
        $container.find(".ncon").hide();
        $container.find('.mcon').show();
        $container.find('.upraise').hide();
        $container.find('.zm-votebar').show();
        showAskcon($container);

    });

    // 收起
    $('.meta_item,.askcon').click(function(){
        var $sender = $(this),
        $container = $sender.parents('.ucon');
        $container.find('.upraise').show();
        $container.find('.zm-votebar').hide();
        $container.find(".ncon").show();
        $container.find('.mcon').hide();
        $container.find('.askcon').hide();
        var pos = $container.find(".ncon").offset().top - 200;
        $("html,body").animate({scrollTop: pos}, 500);
    });
}
/**********************展开 收起  结束 ********************/

	function margz1() {
	    $(this).html("取消关注");
	    $(this).one("click", margz2);
	}
	function margz2() {
	    $(this).html("<i></i>关注问题");
	    $(this).one("click", margz1);
	}
	$(".mar_gz").one("click", margz1);


	function marsc1() {
	    $(this).html("<i class='sc_athover'></i>已收藏");
	    $(this).one("click", marsc2);
	}
	function marsc2() {
	    $(this).html("<i></i>收藏");
	    $(this).one("click", marsc1);
	}
	$(".mar_sc").one("click", marsc1);

	function marxh1() {
	    $(this).html("<i class='xh_athover'></i>432");
	    $(this).one("click", marxh2);
	}
	function marxh2() {
	    $(this).html("<i></i>432");
	    $(this).one("click", marxh1);
	}
	$(".mar_xh").one("click", marxh1);


    $(".mar_pl").click(function(){
        var $sendert = $(this);
        $container = $sendert.parents('.re');
        $(this).find("em").toggle();
        $container.find(".rebox").toggle();
    });

    // $(".mar_pl").click(function(){
    //     $(this).parent(".avatile").siblings(".aItemsay").toggle();
    // });



	for (var i = 0; i < $(".enjlist").length; i++) {
		for (var j = 0; j < $(".enjlist")[i].children.length; j++) {
			if (j>14) {
				$(".enjlist")[i].children[j].style.display = "none";
			}
		}
	}

    $(".dislike").click(function(){
        $(this).parents(".ucon").css("display","none"); 
    });

	$(".dislike").hover(function(){
	    $(this).parent(".likebox").children(".tooltip").css("display","block");
	    },function(){
	    $(this).parent(".likebox").children(".tooltip").css("display","none");
	});


    $(".setdelpinglun").click(function(){
        $("#lightbox").css("display","block");
        $("#fade").css("display","block");
    });
    $(".closea").click(function(){
        $("#lightbox").css("display","none"); 
        $("#fade").css("display","none"); 
    });



    $('#dialogModal_tiwen').click(function(){//提问
        $('.dialog_tiwen').dialogModal({
            onOkBut: function() {},
            onCancelBut: function() {},
            onLoad: function() {
            	$(".zg-inline div span a").click(function(){
					$(this).parents("div")[0].remove();
				});

			    $(".form_text_select textarea").focus(function(){
			    	$(this).parent(".form_text_select").css("border","1px solid #823180"); 
			    });
			    $(".form_text_select textarea").blur(function(){
			    	$(this).parent(".form_text_select").css("border",""); 
			    });
                $(".fit_ch").click(function(){
                    $(".fit_ch .inserttag").focus();
                });
                $(".fit_ch .inserttag").blur(function(){
                    if ($(this).val()=="") {
                        //
                    }else{
                        var $domelem = "<div><span><em>" + $(this).val() + "</em><a href='#'></a></span></div>";
                        $(this).before($domelem);
                        $(this).val("");
                        return false;

                    } if(event.keyCode==32){
                        alert("sefsg");
                    }
                });
                $(".hottag span").click(function(){
                    if ($(this).hasClass("chagcoler")) {
                        return false;
                    }else{
                        var $domelem = "<div><span><em>" + $(this).children("em").text() + "</em><a href='#'></a></span></div>";
                        $(".fit_ch .inserttag").before($domelem);
                        $(this).addClass("chagcoler");
                    }
                });

            },
            onClose: function() {},
        });
    });
    $('.dialogModal_jubao').click(function(){//举报
        $('.dialog_jubao').dialogModal({
            width:650,
            onOkBut: function(e) {
                var $sender = $(e.target);
                var $container = $sender.parents('.dialogModal_body');
                var ckReasons =  $container.find('input[type=checkbox]:checked');
                var txtReson = $container.find('.form_edit').text();
                $('.dialog_jubaook').dialogModal({width:400,});
                //getbutton();
            },
            onCancelBut: function() {},
            onLoad: function() {},
            onClose: function() {},
        });
    });


    $('.dialogModal_deldraft').click(function(){//删除
        $('.dialog_deldraft').dialogModal({width:400});
    });
    
    $('.dialogModal_uc_deldraft').click(function(){//删除
        $('.dialog_uc_deldraft').dialogModal({width:400});
    });

    $('#dialogModal_seepay').click(function(){//pay
        $('.dialog_seepay').dialogModal({
            onOkBut: function() {},
            onCancelBut: function() {},
            onLoad: function() {},
            onClose: function() {},
        });
    });

    $('#dialogModal_seepayok').click(function(){//payok
        $('.dialog_seepayok').dialogModal({});
    });

    $('.dialogModal_reward').click(function(){//赏
        $('.dialog_reward').dialogModal({
            onOkBut: function() {},
            onCancelBut: function() {},
            onLoad: function() {},
            onClose: function() {},
        });
    });



    $('#dialogModal_recharge').click(function(){//充值
        $('.dialog_recharge').dialogModal({
            onOkBut: function() {
                $('.dialog_rechargeok').dialogModal({width:400,});
            },
            onCancelBut: function() {},
            onLoad: function() {},
            onClose: function() {},
        });
    });
    $('#dialogModal_rechargeok').click(function(){//payok
        $('.dialog_rechargeok').dialogModal({});
    });

    $('#dialogModal_withdrawing').click(function(){//充值
        $('.dialog_withdrawing').dialogModal({
            onOkBut: function() {
                $('.dialog_withdrawingok').dialogModal({width:400,});
                $('.dialog_withdrawingclose').dialogModal({width:400,});
            },
            onCancelBut: function() {},
            onLoad: function() {},
            onClose: function() {},
        });
    });
    $('#dialogModal_withdrawingok').click(function(){//payok
        $('.dialog_withdrawingok').dialogModal({});
    });
    $('#dialogModal_withdrawingclose').click(function(){ 
        $('.dialog_withdrawingclose').dialogModal({});
    });

    $('#dialogModal_paycode').click(function(){ 
        $('.dialog_paycode').dialogModal({width:400});
    });
    $('#dialogModal_repaycode').click(function(){
        $('.dialog_repaycode').dialogModal({width:400});
    });
    $('#dialogModal_forpaycode').click(function(){ 
        $('.dialog_forpaycode').dialogModal({width:400});
    });
    $('#dialogModal_changepwd').click(function(){ 
        $('.dialog_changepwd').dialogModal({
            width:400,
            onOkBut: function() {
                $('.dialog_changepwdok').dialogModal({width:400,});
            }
        });
    $('#dialogModal_changepwdok').click(function(){
        $('.dialog_changepwdok').dialogModal({width:400});
    });
    });


    $('#dialogModal_mobile').click(function(){ 
        $('.dialog_mobile').dialogModal({
            width:400
        });
    });

});




/*function getbutton(){
    // alert($(".desctea .form_edit").html());
    var reason = $("#reportid").html().replace(/[]/g,'');
    alert(reason);
    var reason2 = $("#reportid").text().replace(/[]/g,'');
    alert(reason2);
    alert(txtReson);

}*/